export default {
  namespaced: true,
  state: () => ({
    operate: '',
    title: '',
    menuActive: '',
    menuContents: [],
    navs: [
      {
        personal: { 
          title: '个人中心',
          menuActive: 'notice',
          menuContents: [
            { index: 'notice', icon: "el-icon-message-solid", title: '最新通知' },
            { index: 'reserve', icon: "el-icon-s-opportunity", title: '我的预定' },
            { index: 'meeting', icon: "el-icon-s-platform", title: '我的会议' },
            { index: 'promoted', icon: "el-icon-s-promotion", title: '我要升职' }
          ]
        },
        ehr: {
          title: 'EHR',
          menuActive: 'search',
          menuContents: [
            { index: 'depart', icon: "el-icon-s-tools", title: '部门查看' },
            { index: 'search', icon: "el-icon-user-solid", title: '搜索员工'}
          ]
        },
        meeting: { 
          title: '会议功能',
          menuActive: 'look',
          menuContents: [
            { index: 'look', icon: "el-icon-view", title: '查看会议室' },
            { index: 'reserveMeeting', icon: "el-icon-s-flag", title: '预定会议' },
            { index: 'searchMeeting', icon: "el-icon-search", title: '搜索会议' }
          ]
        },
        approval: { 
          title: '审批管理',
          menuActive: 'approval',
          menuContents: [
            { index: 'approval', icon: "el-icon-error", title: '没有审批权限' }
          ]
        },
        apply: { 
          title: '业务申请',
          menuActive: 'car',
          menuContents: [
            { index: 'car', icon: "el-icon-help", title: '用车申请' },
            { index: 'chapter', icon: "el-icon-s-check", title: '用章申请' },
            { index: 'other', icon: "el-icon-info", title: '其他申请' },
            { index: 'applylist', icon: "el-icon-document-checked", title: '申请列表' }
          ]
        },
        chat: { 
          title: '聊天沟通',
          menuActive: 'chat',
          menuContents: [
            { index: 'chat', icon: "el-icon-s-custom", title: '部门群聊' }
          ]
        },
        communicate: { 
          title: '资讯交流',
          menuActive: '', 
          menuContents: []
        },
        video: { 
          title: '视频功能',
          menuActive: '', 
          menuContents: []
        },
        cloudDisk: {
          title: '公共云盘',
          menuActive: 'disk',
          menuContents: [
            { index: 'disk', icon: "el-icon-upload", title: '云盘' }
          ]
        },
        amuse: { 
          title: '娱乐活动',
          menuActive: 'prize',
          menuContents: [
            { index: 'prize', icon: "el-icon-coordinate", title: '抽奖' },
            { index: 'record', icon: "el-icon-document", title: '获奖记录' }
          ]
        }
      },
      {
        personal: { 
          title: '个人中心',
          menuActive: 'notice',
          menuContents: [
            { index: 'notice', icon: "el-icon-message-solid", title: '最新通知' },
            { index: 'reserve', icon: "el-icon-s-opportunity", title: '我的预定' },
            { index: 'meeting', icon: "el-icon-s-platform", title: '我的会议' },
            { index: 'promoted', icon: "el-icon-s-promotion", title: '我要升职' }
          ]
        },
        ehr: { 
          title: 'EHR',
          menuActive: 'login',
          menuContents: [
            { index: 'depart', icon: "el-icon-s-tools", title: '部门查看' },
            { index: 'search', icon: "el-icon-user-solid", title: '搜索员工' }
          ]
        },
        meeting: { 
          title: '会议功能',
          menuActive: 'look',
          menuContents: [
            { index: 'look', icon: "el-icon-view", title: '查看会议室' },
            { index: 'reserveMeeting', icon: "el-icon-s-flag", title: '预定会议' },
            { index: 'searchMeeting', icon: "el-icon-search", title: '搜索会议' }
          ]
        },
        approval: { 
          title: '审批管理',
          menuActive: 'register',
          menuContents: [
            { index: 'goods', icon: "el-icon-folder-checked", title: '其他审批' }
          ]
        },
        apply: { 
          title: '业务申请',
          menuActive: 'car',
          menuContents: [
            { index: 'car', icon: "el-icon-help", title: '用车申请' },
            { index: 'chapter', icon: "el-icon-s-check", title: '用章申请' },
            { index: 'other', icon: "el-icon-info", title: '其他申请' },
            { index: 'applylist', icon: "el-icon-document-checked", title: '申请列表' }
          ]
        },
        chat: { 
          title: '聊天沟通',
          menuActive: 'chat',
          menuContents: [
            { index: 'chat', icon: "el-icon-s-custom", title: '部门群聊' }
          ]
        },
        communicate: { 
          title: '资讯交流',
          menuActive: '', 
          menuContents: []
        },
        video: { 
          title: '视频功能',
          menuActive: '', 
          menuContents: []
        },
        cloudDisk: { 
          title: '公共云盘',
          menuActive: 'disk',
          menuContents: [
            { index: 'disk', icon: "el-icon-upload", title: '云盘' },
            { index: 'diskManage', icon: "el-icon-s-tools", title: '云盘管理' }
          ]
        },
        amuse: { 
          title: '娱乐活动',
          menuActive: 'prize',
          menuContents: [
            { index: 'prize', icon: "el-icon-coordinate", title: '抽奖' },
            { index: 'grant', icon: "el-icon-collection", title: '奖品发放' },
            { index: 'record', icon: "el-icon-document", title: '获奖记录' }
          ]
        }
      },
      {
        personal: { 
          title: '个人中心',
          menuActive: 'notice',
          menuContents: [
            { index: 'notice', icon: "el-icon-message-solid", title: '最新通知' },
            { index: 'reserve', icon: "el-icon-s-opportunity", title: '我的预定' },
            { index: 'meeting', icon: "el-icon-s-platform", title: '我的会议' },
            { index: 'promoted', icon: "el-icon-s-promotion", title: '我要升职' }
          ]
        },
        ehr: { 
          title: 'EHR',
          menuActive: 'login',
          menuContents: [
            { index: 'depart', icon: "el-icon-s-tools", title: '部门查看' },
            { index: 'search', icon: "el-icon-user-solid", title: '搜索员工' }
          ]
        },
        meeting: { 
          title: '会议功能',
          menuActive: 'look',
          menuContents: [
            { index: 'look', icon: "el-icon-view", title: '查看会议室' },
            { index: 'addMeeting', icon: "el-icon-circle-plus", title: '添加会议室' },
            { index: 'reserveMeeting', icon: "el-icon-s-flag", title: '预定会议' },
            { index: 'searchMeeting', icon: "el-icon-search", title: '搜索会议' }
          ]
        },
        approval: { 
          title: '审批管理',
          menuActive: 'register',
          menuContents: [
            { index: 'registerApproval', icon: "el-icon-finished", title: '人事审批' },
            { index: 'meetingApproval', icon: "el-icon-edit-outline", title: '会议审批' },
            { index: 'goods', icon: "el-icon-folder-checked", title: '其他审批' }
          ]
        },
        apply: { 
          title: '业务申请',
          menuActive: 'car',
          menuContents: [
            { index: 'car', icon: "el-icon-help", title: '用车申请' },
            { index: 'chapter', icon: "el-icon-s-check", title: '用章申请' },
            { index: 'other', icon: "el-icon-info", title: '其他申请' },
            { index: 'applylist', icon: "el-icon-document-checked", title: '申请列表' }
          ]
        },
        chat: { 
          title: '聊天沟通',
          menuActive: 'chat',
          menuContents: [
            { index: 'chat', icon: "el-icon-s-custom", title: "部门群聊" }
          ]
        },
        communicate: { 
          title: '资讯交流',
          menuActive: '', 
          menuContents: []
        },
        video: { 
          title: '视频功能',
          menuActive: '', 
          menuContents: []
        },
        cloudDisk: { 
          title: '公共云盘',
          menuActive: 'disk',
          menuContents: [
            { index: 'disk', icon: "el-icon-upload", title: '云盘' },
            { index: 'diskManage', icon: "el-icon-s-tools", title: '云盘管理' }
          ]
        },
        amuse: { 
          title: '娱乐活动',
          menuActive: 'prize',
          menuContents: [
            { index: 'prize', icon: "el-icon-coordinate", title: '抽奖' },
            { index: 'record', icon: "el-icon-document", title: '获奖记录' }
          ]
        }
      }
    ]
    
  }),
  mutations: {
    setMenuActive(state, menuActive) {
      state.menuActive = menuActive
    },
    setOperate(state, operate) {
      state.operate = operate
    },
    initNav(state, {role}) {
      let currentNav = state.navs[role][state.operate] || []
      if(Object.keys(currentNav).length !== 0) {
        state.title = currentNav.title
        state.menuActive = currentNav.menuActive
        state.menuContents = currentNav.menuContents
      }
    }
  },
  actions: {

  },
  getters: {
    getRoleNav: state => role => state.navs[role]
  }
}